<%--
    
    Author     : Nina
--%>
<%@ page import="webapp.model.Restaurant" %>
<%@ page import="webapp.model.User" %>
<%@ page import="webapp.model.UserManager" %>

<%
    Restaurant[] recommend_restaurant = (Restaurant[]) request.getAttribute("recommend");
%>
<%@include file="/includes/header.jsp" %>
<link href="includes/css/recipelist.css" rel="stylesheet" type="text/css">
<div id="body">
    <%@include file="/includes/menu.jsp" %>
    <div id="right">
        <ul id="latest">
        <%
        UserManager mgr = new UserManager();
        for(int i = 0; i < recommend_restaurant.length; i++){
            Restaurant r = recommend_restaurant[i];
            //String author=mgr.getUserNameByID(r.getOwnerId());

            String image_path = r.getImage_url();
            if(image_path == null)
                image_path = Integer.toString(r.getId()) + ".jpeg";

            String rate = "";
            rate = r.getRating();
            
            String hours = r.getOpenHours();
            String price = r.getPriceRange();
            String website = r.getWebsite();
            String address = r.getAddress();
          
    %>
                <li id="recipe_<%=r.getId() %>" >
                    <img width="140" height="140" title="<%=r.getName()%>" src="restaurants/<%=image_path %>"/>
                    <p class="title"><a href="viewrestaurant?restaurant_id=<%=r.getId() %>"><%=r.getName()%></a></p>
                    <p class="rating">Rating: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=rate %>/5.0</p>
                    <p class="hours">Hours: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=hours %></p>
                    <p class="price">Price Range: &nbsp;<%=price %></p>
                    <p class="website">Website: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=website %></p>
                    <p class="address">Address: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=address %></p>
                </li>
       <%  }
        %>
        </ul>
    </div>
</div>
<%@include file="/includes/footer.jsp" %>
